#ifndef __CACHE2_H__
#define __CACHE2_H__

#include "common.h"

/* L2 Cache parameters (PA3 optional task 1) */
#define L2_BLOCK_SIZE   64u
#define L2_BLOCK_MASK   (L2_BLOCK_SIZE - 1)
#define L2_WAYS         16u
#define L2_SETS         4096u
#define L2_SET_MASK     (L2_SETS - 1)
#define L2_OFFSET_BITS  6u
#define L2_INDEX_BITS   12u

void cache2_init(void);
void cache2_stats_dump(void);
void cache2_stats_reset(void);

/* Block-granularity interface for upper layer (L1) */
void cache2_read_block(hwaddr_t aligned_addr, uint8_t *buf /*64B*/);

/* Byte/halfword/word write interface for upper layer (L1 write-through) */
void cache2_write_bytes(hwaddr_t addr, size_t len, uint32_t data);

#endif

